package ch.zbw.timeline.service;

import java.sql.Time;
import java.util.Calendar;
import java.util.List;

import ch.zbw.timeline.domain.DailyPresence;
import ch.zbw.timeline.domain.Employee;

/**
 * Interface that handles the dailyPresences. The dailyPresences are generated
 * and saved to the database and they can be read from the database
 * 
 * @author Andreas Kaderli
 * @version 12.12.2011
 * 
 */
public interface DailyPresenceService {

	/**
	 * These Method create a new DailyPresence, after create the method save the
	 * DailyPresence to the database
	 * 
	 * @param employee
	 *            the employee who created the dailyPresence
	 * @param dateOfPresence
	 *            the date of the dailyPresence
	 * @param morningStart
	 *            the time of the morningStart from the dailyPresence
	 * @param morningEnd
	 *            the time of the morningEnd from the dailyPresence
	 * @param afternoonStart
	 *            the time of the afternoonStart from the dailyPresence
	 * @param afternoonEnd
	 *            the time of the afternoonEnd from the dailyPresence
	 * @param morningVacation
	 *            if the morning is a vacation
	 * @param afternoonVacation
	 *            if the afternoon is a vacation
	 * @return returns the generated dailyPresence
	 */
	public DailyPresence createDailyPresence(Employee employee, Calendar dateOfPresence, Calendar morningStart,
			Calendar morningEnd, Calendar afternoonStart, Calendar afternoonEnd, boolean morningVacation,
			boolean afternoonVacation);

	/**
	 * These Method save the dailyPresence if the dailyPresence have some
	 * changes
	 * 
	 * @param dailyPresence
	 *            the dailyPresence who have changed
	 * @return returns the changed dailyPresence
	 */
	public DailyPresence saveDailyPresence(DailyPresence dailyPresence);

	/**
	 * These Method returns all dailyPresence form the database by employee
	 * 
	 * @param employee
	 *            the employee from dailyPresence
	 * @return returns the list of dailyPresence by employee
	 */
	public List<DailyPresence> getAllDailyPresences(Employee employee);

	/**
	 * These Method return the dailyPresence from the database by employee and
	 * date
	 * 
	 * @param employee
	 *            the employee from dailyPresence
	 * @param newDay
	 *            the day from dailyPresence
	 * @return return on dailyPresence by employee and date
	 */
	public DailyPresence getDailyPresence(Employee employee, Calendar newDay);

	/**
	 * These Method return the presenceTime return from dailyPresence
	 * 
	 * @param dailyPresence
	 *            the dailyPresence
	 * @return return the time of the dailyPresence
	 */
	public Time getPresenceTimeTotal(DailyPresence dailyPresence);

	/**
	 * These Method return the unused time from dailyPresence
	 * 
	 * @param dailyPresence
	 *            the dailyPresence
	 * @return returns the unused time
	 */
	public Time getPresenceTimeUnused(DailyPresence dailyPresence);

}
